//package logging;
//
//import java.io.BufferedWriter;
//import java.io.FileOutputStream;
//import java.io.FileWriter;
//import java.io.PrintWriter;
//import java.text.DateFormat;
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.HashSet;
//import java.util.logging.SimpleFormatter;
//import java.io.FileOutputStream;
//import java.util.logging.Formatter;
//import java.util.logging.Handler;
//import java.util.logging.LogRecord;
//
//import net.jxta.peer.PeerID;
//
///**
// * Logs the uptime for a peer
// * @author Lasse
// * @param <AbstractPeer>
// *
// */
//public class Graph {
//	
//	private FileOutputStream fileOutputStream;
//	private PrintWriter printWriter;
//	private Calendar currentDate;
//	private SimpleDateFormat formatter;
//	private PeerID peerId;
//	private static final DateFormat df = new SimpleDateFormat("ddMMyyyyhhmmss");
//	private ArrayList<AbstractPeer> peers;
//	private AbstractPeer peer;
//	private String graph;
//	/**
//	 * @param <AbstractPeer>
//	 * 
//	 */
//	public Graph(ArrayList<AbstractPeer> peers) {
//		this.peers = peers;
//		graph = "graph network {\n";
//		
//		// First list all peers
//		for (int i = 0;  i<peers.size(); i++) {
//			peer = peers.get(i);
//			graph += "\"P" + peer.getId() + "(" + peer.getCapacity() + ")\"\n";
//		}
//		
//		// Second print their relationships
//		for (int i = 0;  i<peers.size(); i++) {
//			peer = peers.get(i);
//			if(peer.getChildren().size() > 0){
//				for (TestingPeer child : peer.getChildren()) {
//					graph += "\"P" + peer.getId() + "(" + peer.getCapacity() + ")\" -- \"P"+ child.getId()
//							+"("+child.getCapacity() + ")\"\n";
//				}
//			}	
//		}
//		graph = graph + "}";
//	}
//	
//	/**
//	 * Outputs the graph to system.out
//	 */
//	public void printGraph() {
//		System.out.println(graph);
//	}
//	
//	/**
//	 * Outputs the graph in i .dot file
//	 */
//	public void saveGraph() {
//		currentDate = Calendar.getInstance();
//		String filename = "graph_" + df.format(currentDate.getTime()) + ".dot";
//		
//		try {
//			// initialize the file 
//			BufferedWriter out = new BufferedWriter(new FileWriter(filename));
//			out.write(graph);
//			out.flush();
//			out.close();
//		}
//		catch (Exception e) {
//			System.out.print(e);
//		}
//	}
//}
